<template>
    <div @click="JumpSite(item.id)" class="i-item">
      <div class="s-name">
        <div class="s-title">{{item.name}}</div>
        <span v-if="item.unitPrice==0" class="s-free">免</span>
        <span v-if="item.collected" class="s-fav"></span>
      </div>
      <div class="s-addr">
        <div class="s-a-txt">{{item.area}}</div>
        <div class="s-a-long">4.1km</div>
      </div>
      <div class="s-status">
        <div class="s-x"><i>闲</i>9个</div>
        <div class="s-m"><i>忙</i>1个</div>
        <div class="s-a"><i>共</i>10个</div>
      </div>
    </div>
</template>
<style scoped lang="less">
.i-item {
  margin-bottom: 20px;
  background: #fff;
  box-sizing: border-box;
  padding: 15px 30px;
  .s-name {
    height: 50px;
    line-height: 50px;
    width: 100%;
    overflow: hidden;
    .s-title {
      float: left;
      color: #333;
      font-size: 34px;
    }
    .s-free {
      float: left;
      background: #ff3146;
      border-radius: 50%;
      width: 30px;
      height: 30px;
      text-align: center;
      line-height: 32px;
      margin: 10px 10px 0;
      display: inline-block;
      font-size: 20px;
      color: #fff;
    }
    .s-fav {
      float: left;
      width: 40px;
      height: 40px;
      margin: 5px 0 0 0;
      background: url("../public/imgs/star.png") center no-repeat;
      background-size: 40px 40px;
    }
  }
  .s-addr {
    background: url("../public/imgs/icon-a.png") -5px center no-repeat;
    background-size: 32px 32px;
    height: 35px;
    line-height: 35px;
    color: #717171;
    font-size: 24px;
    box-sizing: border-box;
    padding-left: 30px;
    margin: 0 0 5px 0;
    width: 100%;
    overflow: hidden;
    .s-a-txt {
      float: left;
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 500px;
      height: 35px;
    }
    .s-a-long {
      float: left;
      margin: 0 0 0 20px;
      color: #717171;
    }
  }
  .s-status {
    display: -webkit-box;
    width: 500px;
    height: 40px;
    line-height: 40px;

    & > div {
      -webkit-box-flex: 1;
      i {
        display: inline-block;
        width: 30px;
        height: 30px;
        text-align: center;
        line-height: 30px;
        font-style: normal;
        background: #af0311;
        font-size: 22px;
        color: #fff;
        margin-right: 5px;
        border-radius: 5px;
      }
      &.s-x {
        i {
          background: #38a83a;
        }
      }
      &.s-m {
        i {
          background: #e4020d;
        }
      }
      &.s-a {
        i {
          background: #fe9055;
        }
      }
    }
  }
}
</style>
<script>
export default {
  props: ["item"],
  methods: {
    JumpSite(id) {
      this.$router.push({
        path: "deviceInfo",
        query: { id: id }
      });
    }
  }
};
</script>
